package com.umbrella.manage.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 静态文件路径映射（tomcat虚拟路径配置）
 *
 * @author Wan, ChuanLong @ 07/02/2018
 */

@Configuration
public class FileServiceConfig {
	
    @Value("${umbrella.resource.audio.location}")
    private String resourceLocation; 
    
	@Configuration
	public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {

	    @Override
	    public void addResourceHandlers(ResourceHandlerRegistry registry) {
	        registry.addResourceHandler("/audio/**").addResourceLocations("file:" + resourceLocation);
	        super.addResourceHandlers(registry);
	    }

	}
}
